]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
sessionMode: Add support for 'parentMode' property
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 29 Nov 2012 19:42:38 +0000 (20:42 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 5 Dec 2012 20:56:57 +0000 (21:56 +0100)
Defining a mode that differs significantly from the default one
can get rather cumbersome. For convenience, allow mode definitions
to inherit from an existing mode.

https://bugzilla.gnome.org/show_bug.cgi?id=689308

js/ui/sessionMode.js

index 25a5efa95e5190a29b57978195ad93929169a1f6..2774ad6d5b2b9f5c23d2f65ef6b2693175d1ced6 100644 (file)
@@ -14,6 +14,7 @@ const DEFAULT_MODE = 'restrictive';
 
 const _modes = {
     'restrictive': {
+        parentMode: null,
         hasOverview: false,
         showCalendarEvents: false,
         allowSettings: false,
@@ -197,7 +198,13 @@ const SessionMode = new Lang.Class({
 
     _sync: function() {
         let params = this._modes[this.currentMode];
-        params = Params.parse(params, this._modes[DEFAULT_MODE]);
+        let defaults;
+        if (params.parentMode)
+            defaults = Params.parse(this._modes[params.parentMode],
+                                    this._modes[DEFAULT_MODE]);
+        else
+            defaults = this._modes[DEFAULT_MODE];
+        params = Params.parse(params, defaults);
 
         // A simplified version of Lang.copyProperties, handles
         // undefined as a special case for "no change / inherit from previous mode"